﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Wicresoft.Entity.Reconciliation;
using Wicresoft.ARConnector;
using System.Configuration;
using Wicresoft.Utility;


namespace Wicresoft.Reconciliation.DAL
{
    public class NetworkPortDBOperate
    {
        private static readonly string ARServer = ConfigurationManager.AppSettings["ARServer"];
        private static readonly string ARUid = ConfigurationManager.AppSettings["ARUid"];
        private static readonly string ARPwd = ConfigurationManager.AppSettings["ARPwd"];

        private ARProxy<NetworkPort> networkPortARProxy;

        public void SaveNetworkPort(NetworkPort np)
        {
            networkPortARProxy = new ARProxy<NetworkPort>(ARUid, ARPwd, ARServer, string.Empty);
            NetworkPort networkPort = new NetworkPort
            {
                Name = np.Name,
                SerialNumber = np.SerialNumber,
                PortNumber = np.PortNumber,
                PortType = np.PortType,
                HostName = np.HostName,
                MAC = np.MAC,
                IP = np.IP,
                Mask = np.Mask,
                Trunk = np.Trunk,
                AccessVLAN = np.AccessVLAN,
                VLAN = np.VLAN,
                Type = np.Type,
                TagNumber = np.TagNumber,
                DatasetId = np.DatasetId,
                Item = NetworkType.NetworkPort.ToString()
            };
            networkPortARProxy.CreateEntry(networkPort);
        }
    }
}
